package com.googlecode.maurersmarbles;

import android.graphics.Color;
import android.graphics.Point;

import com.googlecode.maurersmarbles.framework.Graphics;

public class SimpleBoard extends Board {

	/**
	 * Creates a new SimpleBoard.
	 * 
	 * @param startXY the x/y location of the board
	 * @param size the size of the board (width and height)
	 */
	public SimpleBoard(Point startXY, int size) {
		super(startXY, size);
	}

	/**
	 * Returns the color for the given player.
	 * 
	 * @param player the player to get the color for
	 * @return the color for the given player
	 */
	protected int getPlayerColor(int player) {
		int color = Color.BLACK;
		switch (player) {
			case 0:
				color = Color.BLUE;
				break;
			case 1:
				color = Color.YELLOW;
				break;
			case 2:
				color = Color.RED;
				break;
			case 3:
				color = Color.GREEN;
				break;
		}
		return color;
	}

	@Override
	public void drawBoard(Graphics g, Point point, int size) {
		g.drawSquare(point.x, point.y, size, Color.LTGRAY);
	}

	@Override
	public void drawEmptySpace(Graphics g, Point point, int size) {
		g.drawCircle(point.x + (int) (size / 2.0), point.y + (int) (size / 2.0),
				(int) (size / 2.0), Color.WHITE);
	}

	@Override
	public void drawHomeSpace(Graphics g, Point point, int size, int player) {
		drawMarble(g, point, size, player);
	}

	@Override
	public void drawMarble(Graphics g, Point point, int size, int player) {
		int color = getPlayerColor(player);
		g.drawCircle(point.x + (int) (size / 2.0), point.y + (int) (size / 2.0),
				(int) (size / 2.0), color);
	}

	@Override
	public void drawSafeSpace(Graphics g, Point point, int size, int player) {
		drawMarble(g, point, size, player);
	}

	@Override
	public void drawStartSpace(Graphics g, Point point, int size, int player) {
		drawMarble(g, point, size, player);
	}

}
